package org.lucky.admin.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.lucky_common.domain.InviteParam;
import org.lucky_common.domain.LuckyShareCount;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
public interface InviteMapper extends BaseMapper<InviteParam> {
    @Select("SELECT COUNT(r.effectiveCount) rid,r.`invitedCode` FROM t_invite r WHERE r.effectiveCount >= 100  GROUP BY r.id")
    @Results(value = {
            @Result(property = "value", column = "rid"),
            @Result(property = "inviteCode", column = "inviteCode"),
    })
    List<LuckyShareCount> getCount();
    @Select("SELECT COUNT(r.effectiveCount) rid,r.`invitedCode` FROM t_invite r WHERE r.effectiveCount IS NULL or r.effectiveCount BETWEEN 0 AND 99 GROUP BY r.id")
    @Results(value = {
            @Result(property = "value", column = "rid"),
            @Result(property = "inviteCode", column = "inviteCode"),
    })
    List<LuckyShareCount> getCount2();
}
